from drg_group.yinchuan_2023.Base import message,intersect,SS_VALID
from drg_group.yinchuan_2023.DRG import MDCD_DRG

def group(record):
  adrg_zd=["C00.000","C00.100","C00.101","C00.400","C00.401","C00.900","C01.x00x003","C02.100","C02.900","C02.900x002","C03.000","C03.100","C03.900","C04.800","C04.900","C05.000","C05.800","C06.001","C06.900","C07.x00","C08.000","C09.900","C11.001","C11.102","C13.900","C14.800x004","C30.103","C31.000","C32.000","C32.001","C32.100","C32.800","C32.900","C39.801","C43.401","C44.000","C44.200x001","C44.201","C49.002","C77.002","C79.834","D00.002"]
  adrg_zd1=[]
  adrg_ss=["01.2502","18.2900x003","18.2900x009","22.6002","22.6200x004","24.3100x003","25.1x01","25.2x01","25.3x00","25.4x00x001","26.2901","26.2904","26.3100x008","26.3100x009","26.3101","26.3103","26.3104","26.3201","26.3202","26.3203","27.3200x001","27.3202","27.4200","27.4301","27.4900x007","27.4902","27.4903","27.4904","27.4906","28.2x01","29.3300x001","29.3901","29.3905","30.0900x016","30.0900x039","30.0901","30.0902","30.0905","30.0906","30.0911","30.1x00","30.1x00x002","30.2900x003","30.2900x012","30.2909","30.3x00","30.3x01","40.3x00x005","40.4000","40.4000x003","40.4100","86.4x01"]
  adrg_ss1=[]
  adrg_ss2=[]
  dept_list=[]
  if True and record.zdList[0] in adrg_zd and record.ssList and record.ssList[0] in adrg_ss and record.ssList and intersect(record.ssList,adrg_ss):
    message('符合DA1入组条件，匹配规则：主诊断匹配、主手术匹配、某一手术匹配')
    
    if MDCD_DRG.DA19_group(record):
      return 'DA19'

    return 'DA1'
  else:
    return ''

